﻿@using BookStore.Repository
@using Microsoft.Extensions.Configuration
@inject IBookRepository _BookRepository
@inject IConfiguration _Configuration
@* @{ *@
@*     var newBook = new NewBookAlertConfig(); *@
@*     _Configuration.Bind("NewBookAlert", newBook); *@
@* } *@

<header>
    <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
        <div class="container">
            <a class="navbar-brand" asp-are="" asp-controller="Home" asp-action="Index">
                <img src="~/images/book1.jpg" width="30" height="30" asp-append-version="true" />
                @_BookRepository.GetAppName()
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse"
                    data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
                <ul class="navbar-nav">
                    <partial name="_LoginInfo" />
                </ul>
                <ul class="navbar-nav flex-grow-1">
                    <li class="nav-item">
                        <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">
                            Home
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="AboutUs">
                            About
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ContactUs">
                            Contact
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" asp-area="" asp-controller="Book" asp-action="GetAllBooks">
                            All Books
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" asp-area="" asp-controller="Book" asp-action="AddNewBook">
                            Add New Book
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    @if (_Configuration.GetValue<bool>("NewBookAlert:DisplayNewBookAlert"))
    {
        <div class="alert alert-info" role="alert">
            @(_Configuration.GetValue<string>("NewBookAlert:BookName"))
        </div>
    }

    @* @if (newBook.DisplayNewBookAlert) *@
    @* { *@
    @*     <div class="alert alert-info" role="alert"> *@
    @*         @(newBook.BookName) *@
    @*     </div> *@
    @* } *@
</header>